﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ClassExamples12Dec
{
    class Program
    {
        static void Main(string[] args)
        {
            Employees firstPerson = new Employees();
            firstPerson.firstName = "Andrey";
            firstPerson.lastName = "Ivanov";
            firstPerson.Salary = 400;

            Employees secondPerson = new Employees();
            secondPerson.firstName = "Mykhail";
            secondPerson.lastName = "Ivanov";
            secondPerson.Salary = 450;

            Employees thirdPerson = new Employees();
            thirdPerson.firstName = "Viniamin";
            thirdPerson.lastName = "Ivanov";
            thirdPerson.Salary = 500;

            Employees fourthPerson = new Employees();
            fourthPerson.firstName = "Yan";
            fourthPerson.lastName = "Ivanov";
            fourthPerson.Salary = 800;

            Employees fifthPerson = new Employees();
            fifthPerson.firstName = "Olga";
            fifthPerson.lastName = "Ivanova";
            fifthPerson.Salary = 750;

            //Employees[] EmployeeArray = new Employees[5];
            //EmployeeArray[0] = firstPerson;
            //EmployeeArray[1] = secondPerson;
            //EmployeeArray[2] = thirdPerson;
            //EmployeeArray[3] = fourthPerson;
            //EmployeeArray[4] = fifthPerson;

            List<Employees> employees = new List<Employees>();
            employees.Add(firstPerson);
            employees.Add(secondPerson);
            employees.Add(thirdPerson);
            employees.Add(fourthPerson);
            employees.Add(fifthPerson);

            int Sum = 0;
            foreach (var Person in employees)
            {
                Person.PrintInfo();
                Sum += Person.Salary;
            }
            Console.WriteLine("Общая зарплата в месяц равна ${0}", Sum);
        }

    }
    
}
